package com.he.architecture.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.he.architecture.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

@Entity
@Getter
@Setter
//流水
public class LineItem extends LogicEntity {
    @Column
    private Integer quantity;
    @Column
    private Double lineItemTotal;

    //流水与上架商品的多对一关系
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"lineItems"})
    private Item item;

    //订单与流水的一对多关系
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnore
    private CustomerOrder customerOrder;
}
